#include "Math3DMainSpace.h"
#include "../Objects/Points.h"
#include "Fysics/Input/FysicsKeyCodes.h"
#include "Fysics/Application/Application.h"
#include "Fysics/Event/WindowEvent.h"

using namespace Fysics;

Math3DMainSpace::Math3DMainSpace()
	: Space("main")
{
}

void Math3DMainSpace::OnStart()
{
	std::vector<glm::vec3> points;
	points.push_back({ 1, 2, 3 });
	points.push_back({ 1.5, 2.5, 3.5 });
	points.push_back({ 1, 2, 1 });
	points.push_back({ 3, 2, 1 });

	Points* po = new Points(points, { 0.8, 0.8, 0.4, 1 }, 20);
	AddObject(po, Fysics::ObjectDisplayMode::SCENE);

	RegisterEvent(Fysics::EventType::KeyPressed, [this](Event& event) {
		WindowKeyPressedEvent e = (WindowKeyPressedEvent&)event;
		switch (e.GetKeyCode())
		{
		case FAR_KEY_Y:
			GetParent()->SwitchSpace("PPT3d");
			break;
		default:
			break;
		}
	});
}

void Math3DMainSpace::OnUpdate()
{
	
}